package net.lcqf.tcp.send;

import java.util.Arrays;

/**
 * 消息类型枚举
 * +----------------------------------------------------------------------
 * // | Talk To [ 聊来改善地区金融服务环境，助力企业发展 ]
 * // +----------------------------------------------------------------------
 * // | Copyright (c) 2021-2025 聊来 All rights reserved.
 * // +----------------------------------------------------------------------
 * // | Licensed ( <a href="http://www.apache.org/licenses/LICENSE-2.0">apache</a> )
 * // +----------------------------------------------------------------------
 * // | @Author: 聊来 <18970881148@qq.com>
 * // +----------------------------------------------------------------------
 * // | DateTime: 2025/2/19 10:24
 * // +----------------------------------------------------------------------
 */
public enum RequestType {

    // 服务器连接成功
    CONNECTED,
    // 登录
    LOGIN,
    // 匹配
    MATCH,
    // 给玩家准备房间
    READY_ROOM,
    // 玩家确认房间
    CONFIRM_ROOM,
    // 更新房间的玩家信息
    UPDATE_ROOM,
    // 取消房间
    CANCEL_ROOM,
    // 选择英雄
    SELECT_HERO,
    // 加载英雄进度
    LOAD_HERO_PROGRESS;

    public static RequestType resolveEvent(int requestType) {
        return Arrays.stream(RequestType.values()).filter(value -> requestType == value.ordinal()).findFirst().orElse(null);
    }
}
